import {Injectable} from '@angular/core';
import {InterfaceProvider} from "@providers/interface";
import {HttpProvider} from "@providers/http";

/*
  Generated class for the WorkerProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class ManagerProvider {

  constructor(private ifp: InterfaceProvider,
              private http:HttpProvider,) {
  }

  /**
   * 管理员登录
   * @param user
   */
  loginForManager(user): Promise<any> {
    return this.http.post("/trust/Inbound/invoke.do",{
      interfaceId: "csm.V10login.query",
      data: JSON.stringify({
        RYXX01: user.userId,
        PASSWORD: user.password
      })
    }).toPromise()
  }

  /**
   * 抢单
   * @param item
   */
  managerGrabsorder(item): Promise<any> {
    return this.ifp.post({
      interfaceId: "csm.css.jcdy.grabsorder",
      data: {list: item}
    }).toPromise()
  }

}
